package com.wehaicao.wehaicaoshardingjdbc.config;


import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.io.Serializable;
import java.util.List;

/**
 * shardingjdbc 配置信息
 */

@Data
@ConditionalOnProperty(name = "shardingjdbc.flag" ,havingValue = "true" )
@ConfigurationProperties(prefix = "db.shardingjdbc")
@Configuration
public class ShardingJdbcProperties extends DataSourceProperties implements Serializable {

    private Profile master;

    private List<Profile> slaves;

    private String clusterName ;


    public Profile getMaster() {
        return master;
    }

    public void setMaster(Profile master) {
        this.master = master;
    }

    public List<Profile> getSlaves() {
        return slaves;
    }

    public void setSlaves(List<Profile> slaves) {
        this.slaves = slaves;
    }

    public String getClusterName() {
        return clusterName;
    }

    public void setClusterName(String clusterName) {
        this.clusterName = clusterName;
    }
}